PG-1058: adding responses and mcp components#56
Merged
jmansdorfer merged 5 commits intomainfrom Mar 2, 2026
Merged
Conversation
bengsoon
requested changes
Mar 2, 2026
bengsoon
left a comment
There was a problem hiding this comment.
Changes proposed for this PR:
tool_choice: make it clearer what is allowed. alsorequiredis not allowed at the backendtools: more descriptive instructions on how to use registered tools, custom mcps and functions
Worthwhile considerations not in this PR:
truncationparam (OpenAI ref) will be helpful to not fail unexpectedly if size exceeds window size for a model
Future improvements as a separate PR:
- More descriptive docstrings and type hints
Question
- Will we have conversation state persistence in our Responses API (e.g. this)
predictionguard/src/responses.py
Outdated
| :param parallel_tool_calls: The parallel tool calls to use. | ||
| :param reasoning: How much effort for model to use for reasoning. Only supported by reasoning models. | ||
| :param safeguards: A dictionary containing the PII, injection, factuality, and toxicity arguments. | ||
| :param stream: Option to stream the API response |
There was a problem hiding this comment.
@jmansdorfer You may want to add a note "Not currently supported."?
| :param stream: Option to stream the API response | ||
| :param temperature: The consistency of the model responses to the same prompt. The higher it is set, the more consistent. | ||
| :param tool_choice: The tool choice to use. | ||
| :param tools: Options to pass to the tool choice. |
There was a problem hiding this comment.
We'll need a clearer docs to highlight types of tools that we support and we'd want to demonstrate how to use org-level registered tools and external mcp tools as examples?
- Registered tools: Registered tools on your organization, for example:
pg-web-search-tool`, then `tools=[{"type": "pg-web-search-tool"}]`- MCP tools: Integration with third-party systems via custom MCP servers, for example:
tools = [
{
"type": "mcp",
"server_url": "https://your-mcp-server.yourcompany.com/mcp/",
"server_label": "your-server-label",
"server_description": "Description of what this MCP server provides",
"authorization": "Your Bearer Token",
"allowed_tools": ["tool_name_1", "tool_name_2"]
}
]- Function calls:
tools = [
{
"type": "function",
"name": "get_current_weather",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
]
}
},
"required": [
"location"
]
},
"strict": false,
"description": "Get the current weather in a given location"
}
]
Contributor
Author
There was a problem hiding this comment.
I can add this as an example here, but that might be more at home in our main docs
There was a problem hiding this comment.
ISWYM. Perhaps at least each type and links to our docs for each of them?
bengsoon
approved these changes
Mar 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.